package com.example.yilanchatserver.business.freechat.enums;

import java.util.Objects;

public class EnumUtils {


        //返回的对象实现CodeEnum接口
    public static <T extends CodeEnum> T getByCode(Class<T> enumClass, String code) {
        for (T each : enumClass.getEnumConstants()) {
            if(Objects.equals(each.getCode(), code)){
                return each;
            }
        }
        return null;
    }


}
